<template>
	<view :data-theme="theme">
		<view class="cash-tab">
			<view :class="amountType == 11?'on':''" @click="changeAmountType(11)">会员钱包</view>
			<view v-if="userInfo.isCardPromoter" :class="amountType == 41?'on':''" @click="changeAmountType(41)">开卡钱包</view>
			<view v-if="userInfo.grade>1 && !userInfo.isCardPromoter" :class="amountType == 21?'on':''" @click="changeAmountType(21)">水站钱包</view>
			<view v-if="userInfo.grade>1 || userInfo.isTeTong" :class="amountType == 31?'on':''" @click="changeAmountType(31)">代理钱包</view>
		</view>
		<view v-if="amountType == 11" class="huiyuan">
			<view :class="drawWay == 1?'check':''" @click="changeDrawWay(1)">个人会员</view>
			<view :class="drawWay == 2?'check':''" @click="changeDrawWay(2)">企业会员(代办)</view>
			<view :class="drawWay == 3?'check':''" @click="changeDrawWay(3)">企业会员(自理)</view>
		</view>
		<template v-if="amountType == 11 && (drawWay==2 || drawWay==3) && !personalCompany.comName">
			<image src="./que.png" class="que-img"></image>
			<view class="que-text">您还未申请会员钱包的企业对公账户，如有需要，请联系客服进行咨询或办理</view>
		</template>
		
		<template v-else>
			<view class="cash-num">
				<view class="cash-num-title">提现金额</view>
				<view class="cash-num-input">
					<view>¥</view>
					<input v-model="money" type="number" placeholder="请输入本次提现金额" @blur="getAmount" />
				</view>
				<view class="cash-num-msg">
					<view>可提现余额为 {{balance}}</view>
					<view class="cash-num-btn" @click="money = balance;getAmount()">全部提现</view>
				</view>
				<view class="cash-num-msg" v-if="amountType == 11 && drawWay==2">
					<view>本月已提现金额：{{personalCompany.havWithdraw || 0}}/300000元</view>
				</view>
			</view>
			<view class="cash-bank" v-if="(amountType==11 || amountType==41) && drawWay==1">
				<view class="cash-bank-title">提现账户</view>
				<radio-group @change="radioChange">
					<view class="cash-bank-item" v-for="(item,key) in list" :index="key">
						<radio :value="key+''" :checked="key === current" color="#E93323"  />
						<view class="cash-bank-item-msg">
							<view class="cash-bank-item-text1">{{item.bankName}}（{{item.account | accountStr}}）</view>
							<view class="cash-bank-item-text2">本月已提现金额：{{limitAmount[item.id] || 0}}/15000元</view>
						</view>
						<view class="cash-bank-item-btn icon-bianji iconfont" @click="goAdd(key)"></view>
					</view>
				</radio-group>
				<view class="cash-bank-new">
					<view class="cash-bank-new-text1">新增银行卡</view>
					<view class="cash-bank-new-text2" @click="goAdd">
						<text>立即绑定</text>
						<text  class="icon-you iconfont" style="font-size: 25rpx;margin-left: 15rpx;"></text>
					</view>
				</view>
			</view>
			<template v-else-if="amountType == 11 && drawWay==2 && personalCompany.comName">
				<view class="cash-bank">
					<view class="cash-bank-title">提现账户(默认协议指定对公账户)</view>
					<view class="cash-bank-itemN">
						<view class="cash-bank-itemN-text1">公司名称：{{personalCompany.comName}}</view>
						<view class="cash-bank-itemN-text1">组织机构代码：{{personalCompany.organizationCode}}</view>
						<view class="cash-bank-itemN-text1">公司性质：{{personalCompany.type | typeStr}}</view>
						<view class="cash-bank-itemN-text1">法人姓名：{{personalCompany.legalPersonName | legalPersonNameStr}}</view>
						<view class="cash-bank-itemN-text1">身份证：{{personalCompany.idcard | idcardStr}}</view>
						<view class="cash-bank-itemN-text1">公司对公账户：{{personalCompany.bankAccount}}</view>
						<view class="cash-bank-itemN-text1">银行开户行：{{personalCompany.openingBank}}</view>
					</view>
				</view>
			</template>
			<template v-else-if="amountType == 11 && drawWay==3 && personalCompany.comName">
				<view class="cash-bank">
					<view class="cash-bank-title">提现账户(默认协议指定对公账户)</view>
					<view class="cash-bank-itemN">
						<view class="cash-bank-itemN-text1">公司名称：{{personalCompany.comName}}</view>
						<view class="cash-bank-itemN-text1">组织机构代码：{{personalCompany.organizationCode}}</view>
						<view class="cash-bank-itemN-text1">公司性质：{{personalCompany.type | typeStr}}</view>
						<view class="cash-bank-itemN-text1" v-if="personalCompany.type == 3">开票：6%专票（平台代扣0%，实际打款100%）</view>
						<radio-group @change="changePersonalTaxRate" v-else>
							<view class="cash-bank-itemN-text3"><radio value="1" :checked="personalTaxRate == 1" color="#E93323"></radio>开票:1%普票(平台代扣7%，实际打款93%)</view>
							<view class="cash-bank-itemN-text3"><radio value="3" :checked="personalTaxRate == 3" color="#E93323"></radio>开票:3%专票(平台代扣4%，实际打款96%)</view>
						</radio-group>
						<view class="cash-bank-itemN-text1">法人姓名：{{personalCompany.legalPersonName | legalPersonNameStr}}</view>
						<view class="cash-bank-itemN-text1">身份证：{{personalCompany.idcard | idcardStr}}</view>
						<view class="cash-bank-itemN-text1">公司对公账户：{{personalCompany.bankAccount}}</view>
						<view class="cash-bank-itemN-text1">银行开户行：{{personalCompany.openingBank}}</view>
					</view>
				</view>
			</template>
			<view v-else class="cash-bank">
				<view class="cash-bank-title">提现账户(默认协议指定对公账户)</view>
				<view class="cash-bank-itemN">
					<view class="cash-bank-itemN-text1">公司名称：{{company.comName}}</view>
					<view class="cash-bank-itemN-text1">组织机构代码：{{company.organizationCode}}</view>
					<view class="cash-bank-itemN-text1">公司性质：{{company.type | typeStr}}</view>
					<view class="cash-bank-itemN-text1" v-if="company.type == 3 && amountType == 31">开票：6%专票（平台代扣0%，实际打款100%）</view>
					<radio-group @change="changeTaxRate" v-else-if="amountType == 31">
						<view class="cash-bank-itemN-text3"><radio value="1" :checked="taxRate == 1 && invoiceType != 2" color="#E93323"></radio>开票:1%普票(平台代扣7%，实际打款93%)</view>
						<view class="cash-bank-itemN-text3"><radio value="2" :checked="taxRate == 1 && invoiceType == 2" color="#E93323"></radio>开票:1%专票(平台代扣6%，实际打款94%)</view>
						<view class="cash-bank-itemN-text3"><radio value="3" :checked="taxRate == 3" color="#E93323"></radio>开票:3%专票(平台代扣4%，实际打款96%)</view>
					</radio-group>
					<view class="cash-bank-itemN-text1">法人姓名：{{company.legalPersonName | legalPersonNameStr}}</view>
					<view class="cash-bank-itemN-text1">身份证：{{company.idcard | idcardStr}}</view>
					<view class="cash-bank-itemN-text1">公司对公账户：{{company.bankAccount}}</view>
					<view class="cash-bank-itemN-text1">银行开户行：{{company.openingBank}}</view>
				</view>
			</view>
		</template>
		
		<view class="cash-bank" style="margin-top: 20rpx;" v-if="amountType == 31 || (amountType == 11 && drawWay==3 && personalCompany.comName)">
			<view class="cash-bank-title">发票明细</view>
			<view class="cash-bank-itemN">
				<view class="cash-bank-itemN-text1">发票抬头：元气氢泉健康科技（杭州）有限公司</view>
				<view class="cash-bank-itemN-text1">发票税号：91330108MAEPEE8781</view>
				<view class="cash-bank-itemN-text1">开户银行：招商银行股份有限公司杭州滨兴支行</view>
				<view class="cash-bank-itemN-text1">银行账户：571923412610001</view>
				<view class="cash-bank-itemN-text1">发票类型：现代服务*推广服务费</view>
				<!-- #ifndef H5 -->
				<view class="cash-bank-itemN-text2 copy" style="color: #2D7DFF;padding: 10rpx 0;" @tap='copy'>一键复制发票信息</view>
				<!-- #endif -->
				<!-- #ifdef H5 -->
				<view class="cash-bank-itemN-text2 copy copy-data" :data-clipboard-text="invoiceMsg" style="color: #2D7DFF;padding: 10rpx 0;" @tap='copy'>一键复制发票信息</view>
				<!-- #endif -->
			</view>
		</view>
		<view class="cash-bank" style="margin-top: 20rpx;" v-if="amountType == 31 || (amountType == 11 && drawWay==3 && personalCompany.comName)">
			<view class="cash-bank-title">发票上传</view>
			<view class="cash-bank-image">
				<view v-if="invoiceUrl && invoiceUrl !=''" class="item-img" @click.stop='uploadpic("invoiceUrl")'>
					<image :src="invoiceUrl"></image>
				</view>
				<view v-else class="item-img" @click.stop='uploadpic("invoiceUrl")'>
					<text style="font-size: 58rpx;margin-bottom: 10rpx;" class="iconfont2 icon2-Gc_121_face-Camera"></text>
					<view>上传发票</view>
				</view>
				<view>
					<view class="cash-bank-itemN-text1">截止日期：每月20日之前</view>
					<view class="cash-bank-itemN-text1">开票金额：{{amount.realPayMoney || '请输入提现金额'}}</view>
					
				</view>
			</view>
		</view>
		<template v-if="amountType == 11 && (drawWay==2 || drawWay==3) && !personalCompany.comName">
			<view style="opacity:1;width: 314rpx;" class="cash-btn" @click="onClickService">联系客服</view>
		</template>
		<template v-else>
			<view :style="{opacity:checkShow?'1':'0.5'}" class="cash-btn" v-if="checkShow" @click="show= true">提现并提交申请</view>
			<view :style="{opacity:checkShow?'1':'0.5'}" class="cash-btn" v-else>提现并提交申请</view>
		</template>
		<view class="cash-tips" v-if="(amountType==11 || amountType==41) && drawWay==1">
			<view class="cash-tips-text1">提现规则：</view>
			<view class="cash-tips-text2">1、所有提现需缴纳税款，个人提现按照“劳务报酬”预扣税金</view>
			<view class="cash-tips-text2">2、劳务提现扣税规则：</view>
			<view class="cash-tips-text2">* 提现金额预先扣除增值税（6%）</view>
			<view class="cash-tips-text2">* 扣除增值税后的剩余金额作为应纳税所得额（提现金额*94%）</view>
			<view class="cash-tips-text2">* 适用3%~45%的累计税率，平台预扣税款完成代缴，次年3~6月需进行个税汇算清缴（可通过个税APP进行查看）</view>
			<view class="cash-tips-text2">3.单次起提金额：23元</view>
			<view class="cash-tips-text2">4、每日可提现次数：1次</view>
			<view class="cash-tips-text2">5、申请提现&打款时间：</view>
			<view class="cash-tips-text2">* 工作日：当日提交申请，则次日18点完成打款</view>
			<view class="cash-tips-text2">* 如遇法定节假日，则自动顺延至下个工作日恢复打款</view>
			<view class="cash-tips-text2">6.单人单月上限：15000元/月</view>
			<view class="cash-tips-text2">* 超额后可需添加新的身份和银行信息（年龄限制18~65周岁之间）</view>
			<view class="cash-tips-text2" style="display: flex;">* 个人所得税预扣率表<view class="cash-num-btn" @click="previewImage('https://watertick.oss-cn-hangzhou.aliyuncs.com/imgs/2.png')">点击查看详情</view></view>
			<view class="cash-tips-text2" style="display: flex;">*增值税+个税代扣（仅供本平台提现纳税参考）<view class="cash-num-btn" @click="previewImage('https://watertick.oss-cn-hangzhou.aliyuncs.com/imgs/1.png')">点击查看详情</view></view>
		</view>
		
		<view class="cash-tips" v-if="amountType==21">
			<view class="cash-tips-text1">提现规则：</view>
			<view class="cash-tips-text2">1、单次起提金额：100元</view>
			<view class="cash-tips-text2">2、单人单月上限：无上限</view>
			<view class="cash-tips-text2">3、根据《水站合作协议》约定结算：</view>
			<view class="cash-tips-text2">1）自营水站的博士水票售卖并核销收益</view>
			<view class="cash-tips-text2">2）水站押金返还</view>
			<view class="cash-tips-text2">4、每日可提现次数：1次</view>
			<view class="cash-tips-text2">5、申请提现&打款时间：</view>
			<view class="cash-tips-text2">1）工作日：当日24点之前提交申请，则次日18点完成打款</view>
			<view class="cash-tips-text2">2）如遇法定节假日，则自动顺延至工作日恢复打款</view>
		</view>
		<view class="cash-tips" v-if="amountType==11 && drawWay==2&& personalCompany.comName">
			<view class="cash-tips-text1">提现规则：</view>
			<view class="cash-tips-text2">1.用户可通过成立个体工商户（该主体不能与水站代理的“个体户主体”及“法人”相同），需自行承担增值税、所得税等相关税费。</view>
			<view class="cash-tips-text2">2.单次起提金额：23元</view>
			<view class="cash-tips-text2">3.每日可提现次数：1次</view>
			<view class="cash-tips-text2">4.申请提现&打款时间：</view>
			<view class="cash-tips-text2">* 工作日：当日提交申请，则次日18点完成打款</view>
			<view class="cash-tips-text2">* 如遇法定节假日，则自动顺延至下个工作日恢复打款</view>
			<view class="cash-tips-text2">5.单人单月上限：300000元/月（代扣代缴综合费率9%）</view>
		</view>
		<view class="cash-tips" v-if="amountType==11 && drawWay==3&& personalCompany.comName">
			<view class="cash-tips-text1">提现规则：</view>
			<view class="cash-tips-text2">1、单次起提金额：100元</view>
			<view class="cash-tips-text2">2、单人单月上限：无上限</view>
			<view class="cash-tips-text2">3、每日可提现次数：1次</view>
			<view class="cash-tips-text2">4、申请提现&打款时间：</view>
			<view class="cash-tips-text2">1）根据自身公司主体开票范国选择开票税点</view>
			<view class="cash-tips-text2">* 普票1%(平台代扣7%，实际打款比例93%)</view>
			<view class="cash-tips-text2">* 专票3%(平台代扣4%，实际打款比例96%)</view>
			<view class="cash-tips-text2">* 专票6%(平台代扣0%，实际打款比例100%)</view>
			<view class="cash-tips-text2">2）用户申请提现金额，系统自动校算显示“开票金额”</view>
			<view class="cash-tips-text2">3）用户根据系统显示金额完成开票，并于提现之前完成发票上传</view>
			<view class="cash-tips-text2">4）平台收到发票之后，将于提现次日之前完成打款</view>
		</view>
		<view class="cash-tips" v-if="amountType==31">
			<view class="cash-tips-text1">提现规则：</view>
			<view class="cash-tips-text2">1、单次起提金额：100元</view>
			<view class="cash-tips-text2">2、单人单月上限：无上限</view>
			<view class="cash-tips-text2">3、根据《代理协议（省/市/区县）》约定结算：</view>
			<view class="cash-tips-text2">1）招商水站的博士水票售卖并核销的提成收益</view>
			<view class="cash-tips-text2">2）代理区域水站的博士水票售卖并核销的管理收益</view>
			<view class="cash-tips-text2">4、每日可提现次数：1次</view>
			<view class="cash-tips-text2">5、申请提现&打款时间：</view>
			<view class="cash-tips-text2">1）根据自身公司主体开票范国选择开票税点</view>
			<view class="cash-tips-text2">* 普票1%(平台代扣7%，实际打款比例93%)</view>
			<view class="cash-tips-text2">* 专票1%(平台代扣6%，实际打款比例94%)</view>
			<view class="cash-tips-text2">* 专票3%(平台代扣4%，实际打款比例96%)</view>
			<view class="cash-tips-text2">* 专票6%(平台代扣0%，实际打款比例100%)</view>
			<view class="cash-tips-text2">2）代理申请提现金额，系统自动校算显示“开票金额”</view>
			<view class="cash-tips-text2">3）代理根据系统显示金额完成开票，并于每月20日之前完成发票上传(超时上传后，自动延迟到次月打款)</view>
			<view class="cash-tips-text2">4）平台收到发票之后，将于当月月底之前完成打款</view>
		</view>
		<neil-modal
		    :show="show" 
		    title="提现申请确认" 
				confirm-text="确认"
				confirm-color="#E93323"
				@cancel="show=false" 
				@confirm="apply()"
		    >
				<view class="model-body" v-if="(amountType == 11 || amountType == 41) && this.drawWay == 1">
					<view class="model-body-text">本次提现金额：{{money}}元</view>
					<view class="model-body-text">提现手续费：{{amount.fee}}元</view>
					<view class="model-body-text">实际到账金额：{{amount.realPayMoney}}</view>
					<view class="model-body-text" v-if="list[current]">银行名称：{{list[current].bankName}}</view>
					<view class="model-body-text" v-if="list[current]">银行卡号：{{list[current].account}}</view>
				</view>
				<view class="model-body" v-if="amountType == 11 && drawWay == 2">
					<view class="model-body-text">本次提现金额：{{money}}元</view>
					<view class="model-body-text">实际到账金额：{{amount.realPayMoney}}</view>
					<view class="model-body-text">收款公司名称：{{personalCompany.comName}}</view>
					<view class="model-body-text">公司银行账户：{{personalCompany.bankAccount}}</view>
					<view class="model-body-text">收款银行名称：{{personalCompany.openingBank}}</view>
				</view>
				<view class="model-body" v-if="amountType == 11 && drawWay == 3">
					<view class="model-body-text">本次提现金额：{{money}}元</view>
					<view class="model-body-text">选择开票税点：{{personalTaxRate}}%</view>
					<view class="model-body-text">实际到账金额：{{amount.realPayMoney}}</view>
					<view class="model-body-text">收款公司名称：{{personalCompany.comName}}</view>
					<view class="model-body-text">公司银行账户：{{personalCompany.bankAccount}}</view>
					<view class="model-body-text">收款银行名称：{{personalCompany.openingBank}}</view>
				</view>
				<view class="model-body" v-if="amountType == 21">
					<view class="model-body-text">本次提现金额：{{money}}元</view>
					<view class="model-body-text">实际到账金额：{{amount.realPayMoney}}</view>
					<view class="model-body-text">收款公司名称：{{company.comName}}</view>
					<view class="model-body-text">公司银行账户：{{company.bankAccount}}</view>
					<view class="model-body-text">收款银行名称：{{company.openingBank}}</view>
				</view>
				<view class="model-body" v-if="amountType == 31">
					<view class="model-body-text">本次提现金额：{{money}}元</view>
					<view class="model-body-text">选择开票税点：{{taxRate}}%</view>
					<view class="model-body-text">实际到账金额：{{amount.realPayMoney}}</view>
					<view class="model-body-text">收款公司名称：{{company.comName}}</view>
					<view class="model-body-text">公司银行账户：{{company.bankAccount}}</view>
					<view class="model-body-text">收款银行名称：{{company.openingBank}}</view>
				</view>
		</neil-modal>
	</view>
</template>

<script>
	import ClipboardJS from "@/plugin/clipboard/clipboard.js";
	import {
		findInfo,
		findUserBanks,
		findComInfo,
		findPersonalComInfo,
		calWithdrawAmount,
		applyWithdraw,
		findUserThisMonthTotal,
	} from '@/api/user.js';
	import {
		toLogin
	} from '@/libs/login.js';
	import {
		mapGetters
	} from "vuex";
	import neilModal from '@/components/neil-modal/neil-modal.vue';
	let app = getApp();
	export default {
		components: {
			neilModal
		},
		filters: {
			accountStr(val) {
				return val?val.substring(val.length-3,val.length):''
			},
			typeStr(val) {
				return {
					1: '个体工商户',
					2: '小规模企业',
					3: '一般纳税人',
				}[val]
			},
			legalPersonNameStr(val) {
				return val?`${val.substring(0,1)}**`:''
			},
			idcardStr(val) {
				return val?`${val.substring(0,val.length-4)}****`:''
			},
		},
		data() {
			return {
				current: 0,
				show: false,
				amountType: 11,
				taxRate: 1,
				invoiceType: 1,
				money: '',
				page: 1,
				limit: 20,
				loaded: false,
				loading: false,
				list: [],
				info: {},
				company: {
					// bankAccount: "353286566659",
					// comName: "绍兴市上虞斫云山房文化有限公司",
					// createTime: "2025-08-25 14:45:31",
					// idcard: "330682198909110421",
					// legalPersonName: "严洁",
					// openingBank: "中国银行股份有限公司上虞支行",
					// organizationCode: "91330604MAEJCUPT3U",
					// type: 2,
				},
				amount: {},
				limitAmount: {},
				invoiceUrl: '',
				
				theme:app.globalData.theme,
				personalCompany: {},
				drawWay: 1,
				personalTaxRate: 1,
			};
		},
		computed: {
			...mapGetters(['isLogin','userInfo']),
			balance() {
				const name = {
					11: 'balanceMember',
					21: 'balanceStation',
					31: 'balanceAgent',
					41: 'balanceKaika'
				}[this.amountType]
				return this.info[name]
			},
			invoiceMsg() {
				return `发票抬头：元气氢泉健康科技（杭州）有限公司；发票税号：91330108MAEPEE8781`
			},
			checkShow() {
				let check = true
				if (this.money == '' || !this.money) {
					check = false
				}
				if (this.amountType == 31 && (this.taxRate == '' || !this.taxRate)) {
					check = false
				} 
				if (this.amountType == 11 && this.drawWay == 2 && this.personalCompany.isComSelfset && (this.personalTaxRate == '' || !this.personalTaxRate)) {
					check = false
				} 
				return check
			},
		},
		onShow() {
			this.changeAmountType(this.amountType)
		},
		/**
		 * 生命周期函数--监听页面加载
		 */
		onLoad: function(options) {
			this.amountType = options.type
			this.changeAmountType(this.amountType)
			// #ifdef H5
			this.$nextTick(function() {
				const clipboard = new ClipboardJS(".copy-data");
				clipboard.on("success", () => {
					this.$util.Tips({
						title: '复制成功'
					});
				});
			});
			// #endif
		},
		/**
		 * 页面上拉触底事件的处理函数
		 */
		onReachBottom: function() {
		},
		methods: {
			onClickService() {
				location.href = 'https://work.weixin.qq.com/kfid/kfcd20454c30cc65f3a';
			},
			previewImage(url) {
				uni.previewImage({
					urls: [url],
					longPressActions: {
						itemList: ['保存图片'],
						success: function(data) {
							console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
						},
						fail: function(err) {
							console.log(err.errMsg);
						}
					}
				});
			},
			goAdd(index) {
				uni.navigateTo({
					url:`/pages/users/user_money_new/add${index !== undefined?('?index='+index):''}`
				})
			},
			// #ifndef H5
			copy: function() {
				let that = this;
				uni.setClipboardData({
					data: this.invoiceMsg
				});
			},
			// #endif
			getAmount() {
				if (this.money == '' || !this.money) return
				if (this.amountType == 31&& (this.taxRate == '' || !this.taxRate)) return
				if (this.amountType == 11 && this.drawWay == 2 && (this.personalTaxRate == '' || !this.personalTaxRate)) return
				if (this.amountType == 11 && this.drawWay == 3 && (this.personalTaxRate == '' || !this.personalTaxRate)) return
				let model = {
					amount: this.money,
					amountType: this.amountType,
				}
				if (this.amountType == 31) {
					model.taxRate =this.taxRate
					if (this.invoiceType == 2) {
						model.invoiceType = 2
					}
				}
				if (this.amountType == 11) {
					model.drawWay = this.drawWay
					if (this.drawWay == 3) {
						model.taxRate =this.personalTaxRate
					} else if (this.drawWay == 2) {
						model.taxRate = 9
					}
				}
				calWithdrawAmount(model).then(res => {
					this.amount = res.data || {}
				})
			},
			changePersonalTaxRate(e) {
				this.personalTaxRate = e.detail.value
				this.getAmount()
			},
			changeTaxRate(e) {
				if (e.detail.value == 2) {
					this.taxRate = 1
					this.invoiceType = 2
				} else {
					this.taxRate = e.detail.value
					this.invoiceType = 1
				}
				
				this.getAmount()
			},
			radioChange(e) {
				this.current = e.detail.value
			},
			changeDrawWay(type) {
				this.drawWay = type
				findPersonalComInfo({
					comType: type,
				}).then(res => {
					this.personalCompany = res.data || {}
					if (this.drawWay == 3) {
						if (this.personalCompany.type == 3) {
							this.changePersonalTaxRate({
								detail:{
									value: 6
								}
							})
						} else {
							this.changePersonalTaxRate({
								detail:{
									value: 1
								}
							})
						}
					}
					
					
				})
				this.getAmount()
			},
			changeAmountType(amountType) {
				this.amountType = amountType
				this.money = ''
				this.amount = {}
				this.page = 1
				this.drawWay = 1
				this.list = []
				this.loaded = false
				this.loading = false
				findInfo({amountType}).then(res => {
					this.info = res.data || {}
				})
				if (this.amountType == 11 || this.amountType == 41) {
					this.getList();
				} else {
					findComInfo().then(res => {
						this.company = res.data
						if (this.company.type == 3) {
							this.changeTaxRate({
								detail:{
									value: 6
								}
							})
						} else {
							this.changeTaxRate({
								detail:{
									value: 1
								}
							})
						}
					})
				}
			},
			async getList() {
				let res = await findUserBanks()
				this.list = res.data || []
				let res2 = await findUserThisMonthTotal()
				console.log(res2)
				this.limitAmount = res2.data || {}
			},
			/**
			 * 上传文件
			 * 
			 */
			uploadpic: function(name) {
				let that = this;
				that.$util.uploadImageOne({
					url: 'upload/image',
					name: 'multipart',
					model: "user",
					pid: 7
				}, function(res) {
					that[name]=res.data.url
				});
			},
			apply() {
				if (this.money == '' || !this.money) return
				if (this.amountType == 31 && (this.taxRate == '' || !this.taxRate)) return 
				if (this.amountType == 11 && this.drawWay == 2 && (this.personalTaxRate == '' || !this.personalTaxRate)) return
				if (this.amountType == 11 && this.drawWay == 3 && (this.personalTaxRate == '' || !this.personalTaxRate)) return
				let model = {
					type: this.amountType,
					money: this.money,
				}
				if (this.amountType == 11 || this.amountType == 41) {
					model.userBankId = this.list[this.current].id
				}
				if (this.amountType == 31) {
					model.taxRate = this.taxRate
					model.invoiceUrl = this.invoiceUrl
					if (this.invoiceType == 2) {
						model.invoiceType = 2
					}
				}
				if (this.amountType == 11 && this.drawWay !=1) {
					model.drawWay = this.drawWay
					if (this.drawWay == 3) {
						model.taxRate =this.personalTaxRate
						model.invoiceUrl = this.invoiceUrl
					} else if (this.drawWay == 2) {
						model.taxRate = 9
					}
				}
				this.show = false
				applyWithdraw(model).then(res => {
					if(res.data == 1) {
						uni.showToast({
							title: '已经提交至平台审核',
							icon: 'none',
							duration: 2000
						})
						setTimeout(()=>{
							uni.navigateBack();
						},2000)
					}
				})
			},
		}
	}
</script>

<style scoped lang='scss'>
	.cash-bank-item-btn{
		color: #E93323;
		display: flex;
		align-items: center;
		font-size: 30rpx;
		padding-right: 10rpx;
	}
	.model-body{
		padding: 60rpx 30rpx;
	}
	.model-body-text{
		font-size: 28rpx;
		color: #555555;
		padding-bottom: 10rpx;
	}
	.cash-bank-itemN{
		margin-top: 30rpx;
		padding-bottom: 25rpx;
	}
	.cash-bank-itemN-text1{
		font-size: 24rpx;
		color: #333333;
		margin-bottom: 8rpx;
	}
	.cash-bank-itemN-text3{
		font-size: 24rpx;
		color: #333333;
		margin-bottom: 8rpx;
		radio {
			transform: translate(0px, 0rpx) scale(0.7);
		}
	}
	.cash-bank-itemN-text2{
		font-size: 24rpx;
		color: #808080;
	}
	.cash-tips{
		padding: 40rpx 28rpx;
	}
	.cash-tips-text1{
		color: #333333;
		font-size: 24rpx;
		line-height: 40rpx;
		margin-bottom: 7rpx;
	}
	.cash-tips-text2{
		color: #999;
		font-size: 24rpx;
		line-height: 40rpx;
	}
	.cash-btn{
		width: 690rpx;
		height: 88rpx;
		background: #E93323;
		border-radius: 44rpx;
		opacity: 0.5;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 32rpx;
		color: #FFFFFF;
		margin: 0 auto;
		margin-top: 100rpx;
	}
	.cash-bank-new-text2{
		display: flex;
		align-items: center;
		font-size: 28rpx;
		color: #999999;
	}
	.cash-bank-new-text1{
		font-size: 28rpx;
		color: #333333;
	}
	.cash-bank-new{
		height: 100rpx;
		margin-top: 40rpx;
		border-top: 1rpx solid #D8D8D8;
		width: 100%;
		display: flex;
		justify-content: space-between;
		align-items: center;
		
	}
	.cash-bank-item-text1{
		font-size: 24rpx;
		color: #333333;
		margin-bottom: 8rpx;
	}
	.cash-bank-item-text2{
		font-size: 24rpx;
		color: #808080;
	}
	.cash-bank-item-msg{
		display: flex;
		flex: 1;
		flex-direction: column;
	}
	.cash-bank-item{
		margin-top: 30rpx;
		display: flex;
		radio{
			margin-right: 8rpx;
			flex-shrink: 0;
			transform: translate(0px, -8rpx) scale(0.8);
		}
	}
	.cash-bank{
		margin: 0 30rpx;
		width: 690rpx;
		background: #FFFFFF;
		border-radius: 20rpx;
		padding: 25rpx 22rpx 0 22rpx;
	}
	.cash-bank-title{
		font-size: 28rpx;
		font-weight: bold;
		color: #333333;
	}
	.cash-num-btn{
		font-size: 24rpx;
		color: #2D7DFF;
		padding-left: 26rpx;
	}
	.cash-num-msg{
		display: flex;
		margin-top: 31rpx;
		font-size: 24rpx;
		color: #666666;
	}
	.cash-num-input{
		padding: 42rpx 0;
		border-bottom: 1rpx solid #D8D8D8;
		margin-top: 16rpx;
		display: flex;
		align-items: center;
		font-size: 36rpx;
		color: #333333;
		input {
			flex: 1;
			padding-left: 10rpx;
		}
	}
	.cash-num-title{
		font-size: 28rpx;
		font-weight: bold;
		color: #333333;
	}
	.cash-num {
		margin: 30rpx;
		margin-bottom: 20rpx;
		width: 690rpx;
		background: #FFFFFF;
		border-radius: 20rpx;
		padding: 25rpx 22rpx 36rpx 22rpx;
	}
	.cash-tab{
		display: flex;
		align-items: center;
		background: #fff;
		height: 88rpx;
		justify-content: center;
		view{
			width: 160rpx;
			display: flex;
			font-size: 28rpx;
			color: #666666;
		}
		.on{
			font-size: 30rpx;
			color: #101012;
		}
	}
	.item-img{
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		width: 180rpx;
		height: 180rpx;
		background: #F8F8FA;
		border-radius: 14rpx;
		overflow: hidden;
		font-size: 28rpx;
		margin-right: 20rpx;
		color: #A8A8B4;
		image{
			width: 180rpx;
			height: 180rpx;
		}
	}
	.cash-bank-image{
		display: flex;
		padding: 30rpx 0;
	}
	.huiyuan{
		display: flex;
		height: 100rpx;
		background: #FFFFFF;
		view{
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 28rpx;
			color: #666666;
			flex: 1;
		}
	}
	.check{
		color: #EA3F30 !important;
		position: relative;
		&::after{
			content: '';
			position: absolute;
			width: 48rpx;
			height: 6rpx;
			background: #EA3F30;
			border-radius: 3rpx;
			left:50%;
			transform: translate(-50%,0);
			bottom: 11rpx;
		}
	}
	.que-img{
		margin-top: 300rpx;
		width: 638rpx;
		height: 252rpx;
		display: block;
	}
	.que-text{
		width: 575rpx;
		font-size: 28rpx;
		color: #333333;
		line-height: 40rpx;
		text-align: center;
		margin: 40rpx auto;
	}
</style>
